package javafx;

/**
 * @author Henrique Fernandes
 */
import javax.swing.JTextPane;
import javax.swing.JScrollPane;
import javafx.stage.Screen;
import javafx.ext.swing.SwingComponent;
import javafx.scene.layout.Stack;
import java.awt.Dimension;
import javax.swing.BorderFactory;
import java.awt.Color;
import javafx.scene.CustomNode;
import javafx.scene.Node;
import java.awt.Font;

/**
*Classe responsavel pela area de texto
*/
public class AreaTexto extends CustomNode{

    /*Criacao do Objeto JTextPane*/
    var textAreaFX: JTextPane = new JTextPane();

    var scroll: JScrollPane = new JScrollPane(textAreaFX);//,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS ,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);

    /**
    *Funcao que cria um no com o Container Stack, onde no mesmo
    *conterao um JTextPane que se adequa ao espaco a ele reservado.
    *
    *@ return Nó JTextPane
    */
    public override function create () : Node {
        textAreaFX.setPreferredSize(new Dimension(Screen.primary.visualBounds.width, 0));
        textAreaFX.setBorder(BorderFactory.createLineBorder(Color.BLACK, 5));
        textAreaFX.setFont(new Font("Times New Roman", Font.BOLD, 18));
        return var stack = Stack{
            layoutY:Screen.primary.visualBounds.height - 190;
            height: 160;
            content: [SwingComponent.wrap(scroll)]
        }
    }
}